#include "Q4_4.h"

void q4_4_run()
{
	int a[6] = {100, 5, 2, 1, 10, 15};
	BubbleSort(a, 1, 6);

	printf("\nQ4.4\n");

	for(int i=0; i<6; i++)
		printf("A[%d]: %d\n", i, a[i]);
}

void BubbleSort(int arr[], int offset, int count)
{
	for(int i=count-1; i>1; i--)
	{
		for(int j=offset; j<i; j++)
		{
			if(arr[j] > arr[j+1])
			{
				int temp = arr[j];
				arr[j] = arr[j+1];
				arr[j+1] = temp;
			}
		}
	}
}